import Vue from 'vue'
import VueRouter from 'vue-router'
// 404 页面
const Error404 = () => import('components/common/home/Error404')
// 登录组件
const LoginJudge = () => import('components/common/loginjudge/LoginJudge')
const LoginMerchant = () => import('components/common/loginmerchant/LoginMerchant')
const LoginUser = () => import('components/common/loginuser/LoginUser')
// 主页组件
const UserHome = () => import('components/common/home/UserHome')
const MerchantHome = () => import('components/common/home/MerchantHome')
const UserWelcome = () => import('components/common/home/UserWelcome')
const MerchantWelcome = () => import('components/common/home/MerchantWelcome')
// 用户页面的组件
const ChangePassword = () => import('components/content/user/accountmanagement/ChangePassword')
const UpdateAddress = () => import('components/content/user/accountmanagement/UpdateAddress')
const MyInformation = () => import('components/content/user/accountmanagement/MyInformation')

// 卡包下的子组件
const GetCard = () => import('components/content/user/cardpackservice/GetCard')
const MyCardPack = () => import('components/content/user/cardpackservice/MyCardPack')
const Statistic = () => import('components/content/user/datastatistics/Statistic')
const MyRecharge = () => import('components/content/user/financialmanagement/MyRecharge')
const UserCenter = () => import('components/content/user/usercenter/UserCenter')
const DetailsPage = () => import('components/content/user/cardDetailsPage/DetailsPage')

// 商家页面的组件
const Coupon = () => import('../components/content/merchant/businessmanagement/Coupon')
const VipCard = () => import('../components/content/merchant/businessmanagement/VipCard')
const ModifyPassword = () => import('../components/content//merchant//enterprisemanagement/ModifyPassword')
const EnterpriseInfo = () => import('../components/content//merchant//enterprisemanagement/EnterpriseInfo')
const Income = () => import('../components/content/merchant/financialmanagement/Income')
const OrderCheck = () => import('../components/content/merchant/ordermanagement/OrderCheck')
const OrderInfo = () => import('../components/content/merchant/ordermanagement/OrderInfo')

// 测试页面
const TestPage = () => import("../components/test/Test.vue")
Vue.use(VueRouter)


const routes = [{
  path: '/',
  redirect: '/loginjudge'
},
{
  path: '/404',
  component: Error404
},
{
  path: '/loginjudge',
  component: LoginJudge,
},
{
  path: '/loginmerchant',
  component: LoginMerchant,
},
{
  path: '/loginuser',
  component: LoginUser,
},
// 卡片详情页面 
{
  path: '/detailsPage',
  component: DetailsPage
},
// 用户登录首页
{
  path: '/userhome',
  component: UserHome,
  redirect: '/mycardpack',
  children: [
  {
    path: '/userwelcome',
    component: UserWelcome
  },
  // 左侧菜单栏组件
  {
    path: '/changepassword',
    component: ChangePassword
  },
  {
    path: '/myinformation',
    component: MyInformation
  },
  {
    path: '/getcard',
    component: GetCard,
    
  },
  {
    path: '/mycardpack',
    component: MyCardPack
  },
  {
    path: '/myrecharge',
    component: MyRecharge
  },
  {
    path: '/usercenter',
    component: UserCenter
  },
  {
    path: '/statistic',
    component: Statistic
  },
  {
    path: '/updateaddress',
    component: UpdateAddress
  }

  ]
},
// 商家登录首页
{
  path: '/merchantHome',
  component: MerchantHome,
  redirect: '/merchantwelcome',
  children: [{
    path: '/merchantwelcome',
    component: MerchantWelcome
  },
  // 左侧菜单栏组件
  {
    path: '/coupon',
    component: Coupon
  },
  {
    path: '/vipcard',
    component: VipCard
  },
  {
    path: '/modifypassword',
    component: ModifyPassword
  },
  {
    path: '/enterpriseinfo',
    component: EnterpriseInfo
  },
  {
    path: '/income',
    component: Income
  },
  {
    path: '/ordercheck',
    component: OrderCheck
  },
  {
    path: '/orderinfo',
    component: OrderInfo
  },
  ]
},

// 测试页面
{
  path:'/test',
  component:TestPage
}
]
const router = new VueRouter({
  routes,
  mode: 'hash'
})

export default router
